
clear

cd "C:\code"

import delimited datasetdiff.txt, delimiters(tab) clear

*label variables
label variable deaths_per_capita "Deaths Per Capita"
*label variable weekly_incr_deaths_per_capita "Weekly Change in Deaths Per Capita"
label variable stayhome "Stay at Home"
label variable emergency "State of Emergency"
label variable nursingmustaccept "Nursing Accept Pos."
label variable novisit "No Nursing Visits"
*label variable schoolshut "Schools Closed"
label variable employeemask "Employees Masks"
label variable maskrec "Masks Recommended"
label variable maskmandatory "Mandatory Masks"
label variable parksclosed "Beaches or Parks Closed"
label variable openreverse "Re-openings Reversed"
label variable noelective "No Elective Procedures"
label variable restclosed "Restaurants Closed"
label variable barsclosed "Bars Closed"
label variable gymsclosed "Gyms Closed"
label variable spasclosed "Spas Closed"
label variable gathermax10 "Gatherings Limited to 10"
label variable gathermax100 "No Gatherings Over 100"
label variable gathermax100plus "No Gatherings Limit>100"
label variable medriskclose "Med. Risk Bus. Closed"
label variable highriskclose "High Risk Bus. Closed"
label variable higherriskclose "Higher Risk Bus. Closed"
label variable highestriskclose "Highest Risk Bus. Closed"
label variable percapincome "Per Capita Income"
label variable popdensity "Population Density"
label variable obese "Obesity"
label variable smoke "Smokers"
label variable housingdensity "Housing Density"
label variable t_first "Days Since First Case"
label variable deaths7_growth "Growth{\sub t+1}"
label variable deaths14_growth "Growth{\sub t+2}"
label variable deaths21_growth "Growth{\sub t+3}"
label variable deaths28_growth "Growth{\sub t+4}"
label variable deaths35_growth "Growth{\sub t+5}"
label variable deaths42_growth "Growth{\sub t+6}"
label variable deaths7_lgrowth "Growth{\sub t-1}"
label variable deaths14_lgrowth "Growth{\sub t-2}"
label variable deaths21_lgrowth "Growth{\sub t-3}"
label variable deaths28_lgrowth "Growth{\sub t-4}"
label variable deaths35_lgrowth "Growth{\sub t-5}"
label variable deaths42_lgrowth "Growth{\sub t-6}"
label variable deaths7_per_cap_lag "Deaths Per Cap{\sub t-1}"
label variable deaths14_per_cap_lag "Deaths Per Cap{\sub t-2}"
label variable deaths21_per_cap_lag "Deaths Per Cap{\sub t-3}"
label variable deaths28_per_cap_lag "Deaths Per Cap{\sub t-4}"
label variable deaths35_per_cap_lag "Deaths Per Cap{\sub t-5}"
label variable deaths42_per_cap_lag "Deaths Per Cap{\sub t-6}"
label variable t "Days Since March 1"
label variable avgtemp "Avg Temperature"
label variable hothumidweekdays "Hot Humid Weekdays"
label variable nursetotpop "Nursing Home Pop."
label variable hothumidweekend "Hot Humid Weekend"
label variable coldweekday "Cold Weekdays"
label variable coldweekend "Cold Weekend"
label variable age65plus "Age 65+"
label variable age85plus "Age 85+"
label variable asian "Asian"
label variable black "Black"
label variable hispanic "Hispanic"
label variable nativeamer "Native Americans"
label variable other "Other"

gen date1 = date(date, "DM20Y") 
format date1 %td
drop if date1 > mdy(12,31,2020)
drop if date1 < mdy(3,1,2020)

drop if missing(deaths42_lgrowth)


*table 4 (main) 

reg deaths7_growth deaths_per_capita deaths7_lgrowth deaths14_lgrowth deaths21_lgrowth deaths28_lgrowth deaths35_lgrowth deaths42_lgrowth t_first t  avgtemp hothumidweekdays hothumidweekend coldweekday coldweekend stayhome emergency nursingmustaccept novisit employeemask  maskrec maskmandatory parksclosed noelective restclosed barsclosed gymsclosed spasclosed  gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose openreverse age65plus age85plus asian black hispanic nativeamer other percapincome  popdensity diabetes obese smoke housingdensity nursetotpop, vce(cluster countyfips) 

outreg2 using "C:\code\output\table4.doc", replace stats(coef se) keep(stayhome emergency nursingmustaccept novisit employeemask maskrec maskmandatory parksclosed openreverse noelective restclosed barsclosed gymsclosed spasclosed gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose) adjr2 dec(3) label nonotes title(Table 4) addtext(Control, YES) sideway noparen 

reg deaths14_growth deaths_per_capita deaths7_lgrowth deaths14_lgrowth deaths21_lgrowth deaths28_lgrowth deaths35_lgrowth deaths42_lgrowth t_first t  avgtemp hothumidweekdays hothumidweekend coldweekday coldweekend stayhome emergency nursingmustaccept novisit employeemask  maskrec maskmandatory parksclosed noelective restclosed barsclosed gymsclosed spasclosed  gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose openreverse age65plus age85plus asian black hispanic nativeamer other percapincome  popdensity diabetes obese smoke housingdensity nursetotpop, vce(cluster countyfips) 

outreg2 using "C:\code\output\table4.doc", append stats(coef se) adjr2 dec(3) label keep(stayhome emergency nursingmustaccept novisit employeemask maskrec maskmandatory parksclosed openreverse noelective restclosed barsclosed gymsclosed spasclosed gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose) addtext(Control, YES) sideway noparen 


reg deaths28_growth deaths_per_capita deaths7_lgrowth deaths14_lgrowth deaths21_lgrowth deaths28_lgrowth deaths35_lgrowth deaths42_lgrowth t_first t  avgtemp hothumidweekdays hothumidweekend coldweekday coldweekend stayhome emergency nursingmustaccept novisit employeemask  maskrec maskmandatory parksclosed noelective restclosed barsclosed gymsclosed spasclosed  gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose openreverse age65plus age85plus asian black hispanic nativeamer other percapincome  popdensity diabetes obese smoke housingdensity nursetotpop, vce(cluster countyfips) 

outreg2 using "C:\code\output\table4.doc", append stats(coef se) adjr2 dec(3) label keep(stayhome emergency nursingmustaccept novisit employeemask maskrec maskmandatory parksclosed openreverse noelective restclosed barsclosed gymsclosed spasclosed gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose) addtext(Control, YES) sideway noparen

reg deaths42_growth deaths_per_capita deaths7_lgrowth deaths14_lgrowth deaths21_lgrowth deaths28_lgrowth deaths35_lgrowth deaths42_lgrowth t_first t  avgtemp hothumidweekdays hothumidweekend coldweekday coldweekend stayhome emergency nursingmustaccept novisit employeemask  maskrec maskmandatory parksclosed noelective restclosed barsclosed gymsclosed spasclosed  gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose openreverse age65plus age85plus asian black hispanic nativeamer other percapincome  popdensity diabetes obese smoke housingdensity nursetotpop, vce(cluster countyfips) 

outreg2 using "C:\code\output\table4.doc", append stats(coef se) adjr2 dec(3) label keep(stayhome emergency nursingmustaccept novisit employeemask maskrec maskmandatory parksclosed openreverse noelective restclosed barsclosed gymsclosed spasclosed gathermax10 gathermax100 gathermax100plus medriskclose highriskclose higherriskclose highestriskclose) addtext(Control, YES) sideway noparen 
